//
//  LoginUser.m
//  AILock
//
//  Created by 谭亚明 on 2020/6/22.
//  Copyright © 2020 tym. All rights reserved.
//

#import "UserModel.h"
#import <YYModel.h>
#import "UserTool.h"
@implementation UserModel


//重写以下几个方法
- (void)encodeWithCoder:(NSCoder*)aCoder {
    [self yy_modelEncodeWithCoder:aCoder];
}

- (id)initWithCoder:(NSCoder*)aDecoder
{
    self = [super init];
    return [self yy_modelInitWithCoder:aDecoder];
}

- (id)copyWithZone:(NSZone*)zone {
    return [self yy_modelCopy];
}

- (NSUInteger)hash {
    return [self yy_modelHash];
}

- (BOOL)isEqual:(id)object {
    return [self yy_modelIsEqual:object];
}

-(NSString*)getRoleStr{
    if (self.familyRole == 1) {
        return @"家长";
    }else if(self.familyRole == 2){
        return @"成员";
    }
    return @"";
}

-(NSString*)getEquipmentImage{
    if (self.headImgUrl) {
        return [NSString stringWithFormat:@"%@%@",BaseImageUrl,self.headImgUrl];
    }else{
        return @"";
    }
}

-(NSString*)getTypeStr{
    NSString *str = [NSString stringWithFormat:@"%@%@%@%@",self.passwordCount>0?@"密码/":@"",self.fingerprintCount>0?@"指纹/":@"",self.cardCount>0?@"卡/":@"",self.remoteControlCount>0?@"遥控/":@""];
    if (str.length) {
        return [str substringWithRange:NSMakeRange(0, [str length] - 1)];
    }else{
        return @"未设置开锁方式";
    }
}

@end
